package com.wjj.sixinone.controller.admin;


import com.wjj.sixinone.common.enums.ApiTypeConst;
import com.wjj.sixinone.common.pojo.vo.BedForm;
import com.wjj.sixinone.common.pojo.vo.BedVO;
import com.wjj.sixinone.common.util.Result;
import com.wjj.sixinone.service.BedService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 小王不秃头
 * @since 2024-07-22
 */
@RestController
@RequestMapping(ApiTypeConst.API_ADMIN+"/bed")
public class BedController {
    @Autowired
    private BedService bedService;
    @GetMapping("/listRoomNo")
    public Result listRoomNo()
    {
        return bedService.listRoomNo();
    }

    @GetMapping("/selectBedByLimit")
    public Result selectBedByLimit(BedVO bedVO)
    {
        return bedService.selectBedByLimit(bedVO);
    }

    @PostMapping("/addBed")
    public Result addBed(@RequestBody BedForm bedForm)
    {
        return bedService.addBed(bedForm);
    }
    @PostMapping("/updateById")
    public Result updateById(@RequestBody BedForm bedForm)
    {
        return bedService.updateBedById(bedForm);
    }
    @PostMapping("/deleteById")
    public Result deleteById(@RequestBody Map<String,Integer> map)
    {
        return bedService.deleteBedById(map);
    }
    @GetMapping("/uploadExcel")
    public void uploadExcel(HttpServletResponse httpServletResponse){
        bedService.uploadExcel(httpServletResponse);
    }
    @GetMapping("/getBedNosByRoomNo")
    public Result getBedNosByRoomNo(@RequestParam("roomNo") String roomNo)

    {
        return bedService.listBedNoByRoomNo(roomNo);
    }
}

